package com.fpx.open.platform.service.impl;

import java.util.Locale;

import javax.annotation.Resource;

import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service;

import com.fpx.open.platform.service.MessageService;

/**
 * i18n消息处理类，根据错误码得到相应的错误信息
 * 
 * @author sunkey
 * @date Mar 15, 2013 6:39:43 PM
 * @version 1.0.0
 * @copyright fpx.com
 */
//@Service(value = "messageService")
public class MessageServiceImpl implements MessageService {

	@Resource
	private MessageSource messageSource;

	/**
	 * @see com.fpx.open.platform.web.manager.MessageManager.getMessage(String
	 *      msgKey, Locale locale)
	 */
	@Override
	public String getMessage(String msgKey, Object[] object, Locale locale) {
		return messageSource.getMessage(msgKey, object, locale);
	}

	/**
	 * @see com.fpx.open.platform.web.manager.MessageManager.getMessage(String
	 *      msgKey, Object[] object, Locale locale)
	 */
	@Override
	public String getMessage(String msgKey, Locale locale) {
		return messageSource.getMessage(msgKey, null, locale);
	}

	/**
	 * @see com.fpx.open.platform.web.manager.MessageManager.getMessage(String
	 *      msgKey)
	 */
	@Override
	public String getMessage(String msgKey) {
		return messageSource.getMessage(msgKey, null, Locale.US);
	}

}
